import { S } from '../../s';
import { IPSAppMenuModel } from './ipsapp-menu-model';
import { IPSAppMenuItem } from '../../control/menu/ipsapp-menu-item';
import { PSAppMenuImpl } from '../../control/menu/psapp-menu-impl';

export class PSAppMenuModelImpl
  extends PSAppMenuImpl
  implements IPSAppMenuModel
{
  protected psappmenuitems: IPSAppMenuItem[];
  getPSAppMenuItems(): IPSAppMenuItem[] | null {
    return (
      this.psappmenuitems ||
      (this.psappmenuitems = this.fillChildListModel(
        this.M.getPSAppMenuItems,
        S._da,
      ) as IPSAppMenuItem[])
    );
  }

  findPSAppMenuItem(objKey: any): IPSAppMenuItem | null {
    return this.getPSModel5(
      S._da,
      this.getPSAppMenuItems(),
      objKey,
    ) as IPSAppMenuItem;
  }
}
